package com.wizard.moremall.project.controller;


import com.wizard.moremall.common.service.IProductService;
import com.wizard.moremall.common.vo.ProductVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author author
 * @since 2024-01-18
 */
@RestController
@RequestMapping("/product")
public class ProductController {

    @Autowired IProductService productService;

    @GetMapping("/list")
    @ResponseBody
    //二级分类跳转商品页面
    private List<ProductVO> getByCategoryId(Integer categoryId){
        return productService.getByCategoryId(categoryId);
    }

    @GetMapping("/item")
    @ResponseBody
    //根据具体id跳转商品详情
    private ProductVO getByProductId(Integer productId){
        return productService.getByProductId(productId);
    }

}
